from socket import *


class Client:
    TARGET = ("127.0.0.1", 5555)
    client = socket()
    client.connect(TARGET)

    def main(self):
        while True:
            send_data = input(">>msg:")
            if send_data:
                self.client.send(send_data.encode())
                data = self.client.recv(1024).decode()
                print(data)
            else:
                print("输入有误请重试")
if __name__=="__main__":
    c=Client()
    c.main()